package com.guoxin.artconcurrency.chapter8;

import java.util.concurrent.CountDownLatch;

/**
 * CountDownLatch测试
 *
 * @author guoxin
 * @date 2019/8/6
 */
public class CountDownLatchTest {
    public static void main(String[] args) throws InterruptedException {
        CountDownLatch cd = new CountDownLatch(2);
        new Thread(() -> {
            System.out.println(1);
            cd.countDown();
            System.out.println(2);
            cd.countDown();
        }).start();

        cd.await();
        System.out.println(3);
    }
}
